package com.anji.hyperneat.nd;

import com.anji.hyperneat.nd.ActivatorND;
import com.anji.hyperneat.nd.NDFloatArray.MatrixIterator;
import com.anji.nn.activationfunction.ActivationFunction;

public class ActivatorNDFacade implements ActivatorND {
	NDFloatArray inputs;
	NDFloatArray outputs;
	int[] outputDimensions;
	String name;
	
	public ActivatorNDFacade(int[] inputDimensions, int[] outputDimensions) {
		this.outputDimensions = outputDimensions;
		this.outputs = new NDFloatArray(outputDimensions);
		this.inputs = new NDFloatArray(inputDimensions);
	}
	
	@Override
	public long cost() {return 0;}
	@Override
	public int getConnectionCount(boolean includeBias) {return 0;}
	@Override
	public void setInputs(NDFloatArray inputs) {this.inputs = inputs;}
	@Override
	public NDFloatArray getInputs() {return inputs;}
	
	@Override
	public NDFloatArray getOutputs() {
		for (MatrixIterator it = outputs.iterator(); it.hasNext(); it.next()) 
			it.set((float) Math.random());
		return outputs;
	}

	@Override
	public boolean isFeedForward() {return true;}

	@Override
	public NDFloatArray next(NDFloatArray stimuli) {
		this.inputs = stimuli;
		return getOutputs();
	}

	@Override
	public NDFloatArray[] nextSequence(NDFloatArray[] stimuli) {
		NDFloatArray[] a = new NDFloatArray[stimuli.length];
		for (int i = 0; i < a.length; i++)
			a[i] = getOutputs();
		return a;
	}

	@Override
	public void reset() {inputs.clear();}

	@Override
	public String getName() {return name;}

	@Override
	public void setName(String string) {this.name = string;}

	@Override
	public int[] getInputDimension() {return inputs.getDimensions();}

	@Override
	public int[] getOutputDimension() {return outputDimensions;}

	@Override
	public NDFloatArray[] getWeights() {return null;}

	@Override
	public NDFloatArray[] getBias() {return null;}
	
	@Override
	public NDFloatArray getLayer(int layer) {return null;}
	
	@Override
	public int getNumLayers() {return -1;}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	@Override
	public NDFloatArray[] getLayers() {return null;}

	@Override
	public ActivationFunction getActivationFunction() {
		// TODO Auto-generated method stub
		return null;
	}
}
